var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, n) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var n in e)
              Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
          })(e, n);
      };
      return function (e, n) {
        function i() {
          this.constructor = e;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        t(e, n),
          (e.prototype =
            null === n
              ? Object.create(n)
              : ((i.prototype = n.prototype), new i()));
      };
    })(),
  AXShoppingItemView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.onLoadShoppingItemDataFn = {
          caller: e,
          code: 1265,
          method: function (t) {
            if (0 == t.code) {
              e.shoppingArr = t.list;
              for (var n, i = [], o = t.list, p = 0; p < o.length; p++)
                (n = {
                  shoppingItemName: { text: o[p].name },
                  shoppingItemBtn: { label: o[p].price + "银" },
                  shopping_ID: o[p].id,
                  item_good_name: { text: o[p].name },
                  item_good_pic: { skin: o[p].pic },
                  item_goods_nums: { text: o[p].price },
                  pic: o[p].pic,
                }),
                  i.push(n);
              e.list_shoppingItem_list.array = i;
            }
          },
        }),
        (e.onLoadShopListData = {
          caller: e,
          code: 1269,
          method: function (t) {},
        }),
        (e.list_shoppingItem.visible = !1),
        (e.list_shoppingItem_list.selectEnable = !0),
        e.list_shoppingItem_list.on(
          Laya.Event.CLICK,
          e,
          e.onShoppingItemDidClickFn
        ),
        (e.list_shoppingItem_list.vScrollBarSkin = ""),
        (e.list_shoppingItem_list.renderHandler = new Laya.Handler(
          e,
          e.updateShoppingItem
        )),
        WebSocketService.addListener(e.onLoadShoppingItemDataFn),
        e.btn_huishouzawu.on(Laya.Event.CLICK, e, e.onHuiShouDidClickFn),
        e.btn_shopping_back.on(Laya.Event.CLICK, e, e.onBackShoppingBackFn),
        (e.tab_type.selectHandler = new Laya.Handler(
          e,
          e.onSelectedFunctionTabFn
        )),
        e
      );
    }
    return (
      __extends(e, t),
      (e.prototype.onHuiShouDidClickFn = function () {
        var t = "zahuo";
        0 == this.tab_type.selectedIndex
          ? (t = "zahuo")
          : 1 == this.tab_type.selectedIndex && (t = "kuangshi");
        var e = AXShoppingDetailView.openShopView(t);
        e.pos(0, 35), Laya.stage.addChild(e);
      }),
      (e.openView = function () {
        return (
          null == this.shopItemVC && (this.shopItemVC = new e()),
          (this.shopItemVC.tab_type.selectedIndex = 0),
          this.shopItemVC
        );
      }),
      (e.prototype.onShoppingItemDidClickFn = function (t) {
        if ("" != t.target.name)
          if ("shoppingItemBtn" == t.target.name) {
            var e = this.shoppingArr[this.list_shoppingItem_list.selectedIndex];
            AXGiveGiftView.show(e);
          } else if (t.target.name) {
            var n = this.shoppingArr[this.list_shoppingItem_list.selectedIndex],
              i = { name: n.name, thing_id: n.id, count: 1, money: n.price };
            DPItemDetailPageView.showItemDetailPageView(
              i,
              "AXShoppingItemView"
            );
          }
      }),
      (e.prototype.updateShoppingItem = function (t, e) {
        var n = t.getChildByName("item_goods_pic");
        t.dataSource.pic
          ? (n.skin = "comp/goods/" + t.dataSource.pic)
          : (n.skin = "comp/goods/none.png");
      }),
      (e.prototype.onSelectedFunctionTabFn = function (t) {
        (this.list_shoppingItem_list.array = []),
          (this.shoppingArr = []),
          0 == t
            ? (WebSocketService.send({ c: 1265, d: { t: 3, pageNum: 0 } }),
              (this.btn_huishouzawu.label = "回收杂货"))
            : 1 == t &&
              (WebSocketService.send({ c: 1265, d: { t: 2, pageNum: 0 } }),
              (this.btn_huishouzawu.label = "回收矿石"));
      }),
      (e.prototype.onBackShoppingBackFn = function () {
        this.removeSelf();
      }),
      e
    );
  })(ui.MarketController.AXShoppingItemViewUI);
